﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class shop_TopSales : PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            SetPageNoCache();
            InitComponents();
            BindData();
        }
    }

    /// </summary>
    /// 设置页面不被缓存
    /// </summary>
    public void SetPageNoCache()
    {
        HttpContext.Current.Response.Buffer = true;
        HttpContext.Current.Response.Expires = 0;
        HttpContext.Current.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
        HttpContext.Current.Response.AddHeader("pragma", "no-cache");
        HttpContext.Current.Response.AddHeader("cache-control", "private");
        HttpContext.Current.Response.CacheControl = "no-cache";
    }

    private void InitComponents()
    {
        Utility.InitUltraWebGrid.InitDisplayLayOut(this.uwgMain);
    }

    private void BindData()
    {
        uwgMain.DataSource = new DAL.Views.V_Shop_TopSales().Open("top 8 *", "CreateShopID = " + _Site.ID, "");
        uwgMain.DataBind();

        //设置序号
        for (int i = 0; i < uwgMain.Rows.Count; i++)
        {
            uwgMain.Rows[i].Cells[1].Text = (i + 1).ToString();
        }
    }
}
